#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <map>
#include <queue>
#include <functional>
#include "hungarian_test.h"
#include "hungarian_optimizer.h"

using namespace std;


int main()
{
  std::vector<std::vector<int>> nb_graph 
      = { {4, 5},{6},{6,7},{4},
          {0, 3},{0},{1,2},{2}
          };
  std::vector<std::vector<int>> components;

  ConnectedComponentAnalysis(nb_graph, components);


  printMatrix(components);

  std::function<bool(int)> is_valid_cost;
  is_valid_cost = std::bind1st(std::greater<int>(), 10);
  cout << is_valid_cost(2) << endl << endl;

  vector< vector<int> > costs_ 
  = {
      {90, 75, 75, 80},
      {35, 85, 55, 65},
      {125, 95, 90, 105},
      {45, 110, 95, 115}
  };
  
  hungarian_test(costs_);
  printMatrix(costs_);

  HungarianOptimizer<int> optimizer_;
  optimizer_.costs(costs_);
  

  std::vector<std::pair<size_t, size_t>> assignments;
  optimizer_.Minimize(&assignments);

  for(size_t i = 0; i < assignments.size(); ++i)
    cout << assignments[i].first << " " << assignments[i].second << endl;

    return 0;
}

